package com.yeswater.multithread.chapter1.test1_11.test6;

import java.util.concurrent.TimeUnit;

/**
 * author : yeswater
 * date : 2023/10/19
 */

public class MyThread extends Thread{

    private int i = 0;

    @Override
    public void run() {
        try {
            while (true) {
                i++;
                System.out.println("i=" + i);
                TimeUnit.SECONDS.sleep(1);
            }
        } catch (InterruptedException e) {
            System.out.println(" 先停止,再遇到 sleep! 进入 catch!");
            e.printStackTrace();
        }
    }
}
